package com.zl.cms.model;

/**
 * 用户组和栏目的多对多映射关系
 * User: zl email:c3tc3tc3t@126.com Date: 14-2-11 Time: 下午2:27
 */
// @Entity
// @Table(name="t_group_channel")
public class GroupChannel {
  private int id;
  private Group group;
  private Channel channel;

  public GroupChannel() {}

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    GroupChannel that = (GroupChannel) o;

    if (id != that.getId()) return false;
    if (!channel.equals(that.getChannel())) return false;
    if (!group.equals(that.getGroup())) return false;

    return true;
  }

  @Override
  public String toString() {
    return "GroupChannel{" + "id=" + id + ", group=" + group + ", channel=" + channel + '}';
  }

  @Override
  public int hashCode() {
    int result = id;
    result = 31 * result + group.hashCode();
    result = 31 * result + channel.hashCode();
    return result;
  }

  public GroupChannel(int id, Group group, Channel channel) {
    this.id = id;
    this.group = group;
    this.channel = channel;
  }

  // @Id
  // @GeneratedValue(strategy = GenerationType.IDENTITY)
  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  // @ManyToOne
  // @JoinColumn(name="g_id")
  public Group getGroup() {
    return group;
  }

  public void setGroup(Group group) {
    this.group = group;
  }

  // @ManyToOne
  // @JoinColumn(name="c_id")
  public Channel getChannel() {
    return channel;
  }

  public void setChannel(Channel channel) {
    this.channel = channel;
  }
}
